package com.mayflygeek.mayflyask.framework.webmvc.util;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.ServletRequestUtils;

/**
 * @author 虫虫
 * @team 蜉蝣极客
 * @link www.mayflygeek.com
 * @Emial chongchong@mayflygeek.com
 * 
 */
public class RequestUtil extends ServletRequestUtils {
	private static final String XML_HTTP_REQUEST = "XMLHttpRequest";
	private static final String X_REQUESTED_WITH = "x-requested-with";

	public static boolean isAjax(HttpServletRequest request) {
		if (request.getHeader(X_REQUESTED_WITH) == null) {
			return false;
		}
		return XML_HTTP_REQUEST.equals(request.getHeader(X_REQUESTED_WITH));
	}
}
